
'''
@名称：简易计算器
@作者：Fida1214
@日期：2025/3/26
'''

print("""
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
                    工作时间到——————快来算数吧！
                    ！Fida牌计算器，你值得拥有！
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
                    @名称：工具——简易计算器
                    @作者：Fida1214
                    @日期：2025/3/26
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
    """)

import math

def Calculate_sum(num1, num2):
    return num1 + num2
def Calculate_sub(num1, num2):
    return num1 - num2
def Calculate_mul(num1, num2):
    return num1 * num2
def Calculate_div(num1, num2):
    if num2 == 0:
        print("除数不能为0！")
        return 0
    else:
        return num1 / num2
def logab(num1,num2):
    return math.log(num1,num2)

print("计算器即将启动,如果您需要计算整数，请按下‘~’，如果您需要计算复数，请按下‘ ！ ’,如果您需要退出，请在一次运算结束后，按下‘ # ’")
while True:
    if input("请输入你的决策") == "~":
        num1 = int(input("请输入第一个数num1:"))
        num2 = int(input("请输入第一个数num2:"))
        Cmark = input("请输入运算符（+  -  *  / log）:")
        if Cmark == '+':
            print("num1",Cmark,"num2 =",Calculate_sum(num1, num2))
        elif Cmark == '-':
            print("num1",Cmark,"num2 =",Calculate_sub(num1, num2))
        elif Cmark == '*':
            print("num1",Cmark,"num2 =",Calculate_mul(num1, num2))
        elif Cmark == '/':
            print("num1",Cmark,"num2 =",Calculate_div(num1, num2))
        elif Cmark == 'log':
            print("以",num2,"为底，以",num1,"的对数为为=",logab(num1,num2))
        elif Cmark == '#':
            break
    elif input("请输入你的决策") == "!":
        num1 = complex(input("请输入第一个数num1:"))
        num2 = complex(input("请输入第一个数num2:"))
        Cmark = input("请输入运算符（+  -  *  /）:")
        if Cmark == '+':
            print("num1",Cmark,"num2 =",Calculate_sum(num1, num2))
        elif Cmark == '-':
            print("num1",Cmark,"num2 =",Calculate_sub(num1, num2))
        elif Cmark == '*':
            print("num1",Cmark,"num2 =",Calculate_mul(num1, num2))
        elif Cmark == '/':
            print("num1",Cmark,"num2 =",Calculate_div(num1, num2))
        elif Cmark == '#':
            break